package com.miracle9.game.entity;

import com.miracle9.game.util.MyUtil;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;

@Entity
public class AdminLog extends BaseEntity {

    private String admin;
    private String datetime;
    @Column(length = 1000)
    private String content;
    private int type;
    private int authority;
    @Column(length = 1000)
    private String contentEn;
    public static final int USER = 0;
    public static final int HALL = 1;
    public static final int OTHER = 2;

    public AdminLog() {
    }

    public AdminLog(String admin, String content, int type, int authority, String contentEn) {
        this.admin = admin;
        this.datetime = MyUtil.dateFormatYMD_HMS_Sting(new Date());
        this.content = content;
        this.type = type;
        this.authority = authority;
        if (contentEn.lastIndexOf(",") == contentEn.length() - 1) {
            contentEn = contentEn.substring(0, contentEn.length() - 1);
        }
        this.contentEn = contentEn;
    }

    public String getAdmin() {
        return this.admin;
    }

    public void setAdmin(String admin) {
        this.admin = admin;
    }

    public int getAuthority() {
        return this.authority;
    }

    public void setAuthority(int authority) {
        this.authority = authority;
    }

    public String getDatetime() {
        return this.datetime;
    }

    public void setDatetime(String datetime) {
        this.datetime = datetime;
    }

    public String getContent() {
        return this.content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getType() {
        return this.type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getContentEn() {
        return this.contentEn;
    }

    public void setContentEn(String contentEn) {
        if (contentEn.lastIndexOf(",") == contentEn.length() - 1) {
            contentEn = contentEn.substring(0, contentEn.length() - 1);
        }
        this.contentEn = contentEn;
    }

    public String toString() {
        return

                "AdminLog [admin=" + this.admin + ", datetime=" + this.datetime + ", content=" + this.content + ", type=" + this.type + ", authority=" + this.authority + ", contentEn=" + this.contentEn + "]";
    }

}
